<?php

//congregation

// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );

/**
*/
class HTML_congregation {

	function casa_view( &$row, $option ) {
		global $params, $Itemid, $access, $mosConfig_live_site;

			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo $row->c_name; ?>
			</div>

			<?php
				if($access->canEdit) {
					?>
				<script language="JavaScript">
				<!--
					function confirmDelete() {
						var agree=confirm("<?php echo _Profile_Delete_Confirm ; ?>");
						if (agree)
							return true;
						else
							return false ;
					}
				//-->
				</script>

				<div class="adminbox">
				<?php
				echo "<a href='"  . sefRelToAbs("index.php?option=$option&rub=casa&task=edit&Itemid=$Itemid&c_id=$row->c_id&p_id=$row->p_id") . "'>" . _Congregation_Edit . "</a> ";
				echo "<a onclick='return confirmDelete()' href='"  . sefRelToAbs("index.php?option=$option&rub=casa&task=delete&Itemid=$Itemid&c_id=$row->c_id&p_id=$row->p_id") . "'>" . _Congregation_Delete . "</a> ";
				?>
				</div>

					<?php
				}
			?>
			<table >
				<tr valign="top">
					<td><?php echo _Casa_Province ; ?> : </td>
					<td>
						<?php echo  "<a href='" . sefRelToAbs( "index.php?option=$option&rub=province&Itemid=$Itemid&p_id=$row->p_id" ) . "'>" .$row->c_pname . "</a>";?></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Address ; ?> : </td>
					<td><?php echo nl2br($row->c_address) ; ?></td>
				</tr>
				<?php
					if($row->c_picfile) {

		echo "
		<script language=\"JavaScript\">
		<!--
		function PopupAlbum(titre, img) {
		w=open(\"\",'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=yes');
		w.document.write(\"<HTML><HEAD><TITLE>\"+titre+\"</TITLE></HEAD>\");
		w.document.write(\"<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+55,document.images[0].height+130); window.focus();} else { setTimeout('check()',250) } }</\"+\"SCRIPT>\");
		w.document.write(\"<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>\");
		w.document.write(\"<table border=1 cellpadding=20px cellspacing=0><tr><td align=center>\");
		w.document.write(\"<IMG src='\"+img+\"' border=0>\");
		w.document.write(\"</td></tr><table>\");
		w.document.write(\"</BODY></HTML>\");
		w.focus();
		w.document.close();
		}
		-->
		</script>
		";
				?>
				<tr valign="top">
				<?php echo "
		  <td valign='top' colspan='2' align='center'>
		  <a href=\"javascript:PopupAlbum('". $row->c_name . "', '" . $mosConfig_live_site . "/media/casa/".$row->c_picfile. "')\" ><img src='" . $mosConfig_live_site . "/media/casa/". $row->c_picfile . "' border='0' width='300'></a>
			  ";
		  ?>
		  </td>
				</tr>
				<?php
					}

				?>
				<tr valign="top">
					<td><?php echo _Casa_Zip ; ?> : </td>
					<td><?php echo $row->c_zip ; ?></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_City ; ?> : </td>
					<td><?php echo $row->c_city ; ?></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_State ; ?> : </td>
					<td><?php echo $row->c_state ; ?></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Country ; ?> : </td>
					<td><?php echo $row->c_country ;?></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Tel ; ?> : </td>
					<td><?php echo $row->c_tel ; ?></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Fax ; ?> : </td>
					<td><?php echo $row->c_fax ; ?></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Email ; ?> : </td>
					<td><?php echo nl2br($row->c_email) ; ?></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Web ; ?> : </td>
					<td><?php echo $row->c_web ; ?></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Foundation ; ?> : </td>
					<td><?php echo $row->c_web ; ?></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Diocese ; ?> : </td>
					<td><?php echo $row->c_diocese ; ?></td>
				</tr>
			</table>

	<?php
		if($row->c_members) {
			?>
			<br />
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo _Profile_List; ?>
			</div>
			<table width="100%">
				<tr valign="top" align="center">
					<th><?php echo _Profile_Name ; ?></th>
					<th><?php echo _Profile_Email ; ?></th>
		<?php
			if($access->canEdit) {
				echo "<th>" . _Congregation_Admin . "</th>";
			}
		?>
				</tr>
			<?php
				foreach($row->c_members as $member) {
					echo "<tr><td> <a href='" . sefRelToAbs("index.php?option=$option&rub=member&Itemid=$Itemid&username=" . $member->username ) . "'>" . $member->username . ( $member->lname || $member->fname ? " (" . $member->lname . " " . $member->fname . ")" : "") . "</a> </td>
						<td> $member->lemail </td>
					";
					if($access->canEdit) {
						echo '<td valign="top" align="center">';
							echo '<a href="' . sefRelToAbs("index.php?option=$option&rub=member&task=edit&Itemid=$Itemid&username=" . $member->username ) . '">' . _Congregation_Edit . '</a></td>';
					}
					echo "
					</tr>
					";
				}
			echo "
			</table>
			";
		}
	}



	function casa_edit( &$row, &$provinces, &$lists, $option ) {
		global $params, $Itemid;

			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo _Casa_Edit; ?>
			</div>
			<form method="post" action="index.php" enctype="multipart/form-data">
					<input type="hidden" name="c_id" value="<?php echo $row->c_id ;?>" />
					<input type="hidden" name="option" value="<?php echo $option ;?>" />
					<input type="hidden" name="Itemid" value="<?php echo $Itemid ;?>" />
					<input type="hidden" name="rub" value="casa" />
					<input type="hidden" name="task" value="save" />
			<table >
				<tr valign="top">
					<td><?php echo _Casa_Name ; ?> : </td>
					<td><input type="text" name="c_name"  style="width: 300px" value="<?php echo $row->c_name ; ?>"/></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Order ; ?> : </td>
					<td><?php echo $lists['ordering'] ;?></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Province ; ?> : </td>
					<td><select name="p_id"  style="width: 300px"/>
						<option />
						<?php
							if($provinces) {
								foreach($provinces as $province) {
									$selected = ($row->p_id == $province->p_id) ? " selected " : "";
									echo "<option value='" . $province->p_id . "' $selected >" . $province->p_name . "</option>";
								}
							}
						?>
						</select>
					</td>
				</tr>
				<tr valign="top">
				  <td>
						<?php echo _Casa_Photo ;?> : </b>
				  </td>
				  <td>
				   <input type='file' size='30' name='imagefile' style='width: 300px'><br>
				  </td>
				 </tr>
				<tr valign="top">
					<td><?php echo _Casa_Address ; ?> : </td>
					<td><textarea name="c_address" rows="6" style="width: 300px"><?php echo $row->c_address ; ?></textarea></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Zip ; ?> : </td>
					<td><input type="text" name="c_zip"  style="width: 300px" value="<?php echo $row->c_zip ; ?>"/></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_City ; ?> : </td>
					<td><input type="text" name="c_city"  style="width: 300px" value="<?php echo $row->c_city ; ?>"/></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_State ; ?> : </td>
					<td><input type="text" name="c_state"  style="width: 300px" value="<?php echo $row->c_state ; ?>"/></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Country ; ?> : </td>
					<td><select name="c_country"  style="width: 300px"/>
						<option><?php echo $row->c_country ;?></option>
<OPTION>Afghanistan<OPTION>Albania<OPTION>Algeria<OPTION>American Samoa<OPTION>Andorra<OPTION>Angola<OPTION>Anguilla<OPTION>Antarctica<OPTION>Antigua and arbuda<OPTION>Argentina<OPTION>Armenia<OPTION>Aruba<OPTION>Australia<OPTION>Austria<OPTION>Azerbaijan<OPTION>Bahamas<OPTION>Bahrain<OPTION>Bangladesh<OPTION>Barbados<OPTION>Belarus<OPTION>Belgium<OPTION>Belize<OPTION>Benin<OPTION>Bermuda<OPTION>Bhutan<OPTION>Bolivia<OPTION>Bosnia and Herzegovina<OPTION>Botswana<OPTION>Bouvet Island<OPTION>Brazil<OPTION>British Indian Ocean Territory<OPTION>Brunei Darussalam<OPTION>Bulgaria<OPTION>Burkina Faso<OPTION>Burundi<OPTION>Cambodia<OPTION>Cameroon<OPTION>Canada<OPTION>Cape Verde<OPTION>Cayman Islands<OPTION>Central African Republic<OPTION>Chad<OPTION>Chile<OPTION>China<OPTION>Christmas Island<OPTION>Cocos Keeling Islands<OPTION>Colombia<OPTION>Comoros<OPTION>Congo<OPTION>Cook Islands<OPTION>Costa Rica<OPTION>Ivory Coast<OPTION>Croatia<OPTION>Cuba<OPTION>Cyprus<OPTION>Czech Republic<OPTION>Denmark<OPTION>Djibouti<OPTION>Dominican Republic<OPTION>Dominica<OPTION>East Timor<OPTION>Ecuador<OPTION>Egypt<OPTION>El Salvador<OPTION>Equatorial Guinea<OPTION>Eritrea<OPTION>Estonia<OPTION>Ethiopia<OPTION>Falkland Islands<OPTION>Faroe Islands<OPTION>Fiji<OPTION>Finland<OPTION>France<OPTION>French Guiana<OPTION>French Polynesia<OPTION>French Southern Territories<OPTION>Gabon<OPTION>Gambia<OPTION>Georgia<OPTION>Germany<OPTION>Ghana<OPTION>Gibraltar<OPTION>Greece<OPTION>Greenland<OPTION>Grenada<OPTION>Guadeloupe<OPTION>Guam<OPTION>Guatemala<OPTION>Guinea-Bissau<OPTION>Guinea<OPTION>Guyana<OPTION>Haiti<OPTION>Heard and McDonald Islands<OPTION>Honduras<OPTION>Hong Kong<OPTION>Hungary<OPTION>Iceland<OPTION>India<OPTION>Indonesia<OPTION>Iran<OPTION>Iraq<OPTION>Ireland<OPTION>Israel<OPTION>Italy<OPTION>Jamaica<OPTION>Japan<OPTION>Jordan<OPTION>Kazakhstan<OPTION>Kenya<OPTION>Kiribati<OPTION>North Korea<OPTION>South Korea<OPTION>Kuwait<OPTION>Kyrgyzstan<OPTION>Laos<OPTION>Latvia<OPTION>Lebanon<OPTION>Lesotho<OPTION>Liberia<OPTION>Libya<OPTION>Liechtenstein<OPTION>Lithuania<OPTION>Luxembourg<OPTION>Macau<OPTION>Macedonia<OPTION>Madagascar<OPTION>Malawi<OPTION>Malaysia<OPTION>Maldives<OPTION>Mali<OPTION>Malta<OPTION>Marshall slands<OPTION>Martinique<OPTION>Mauritania<OPTION>Mauritius<OPTION>Mayotte<OPTION>Mexico<OPTION>Micronesia<OPTION>Moldova<OPTION>Monaco<OPTION>Mongolia<OPTION>Montserrat<OPTION>Morocco<OPTION>Mozambique<OPTION>Myanmar<OPTION>Namibia<OPTION>Nauru<OPTION>Nepal<OPTION>Netherlands Antilles<OPTION>Netherlands<OPTION>New Caledonia<OPTION>New Zealand<OPTION>Nicaragua<OPTION>Nigeria<OPTION>Niger<OPTION>Niue<OPTION>Norfolk Island<OPTION>Northern Mariana slands<OPTION>Norway<OPTION>Oman<OPTION>Pakistan<OPTION>Palau<OPTION>Panama<OPTION>Papua New Guinea<OPTION>Paraguay<OPTION>Peru<OPTION>Philippines<OPTION>Pitcairn<OPTION>Poland<OPTION>Portugal<OPTION>Puerto Rico<OPTION>Qatar<OPTION>Reunion<OPTION>Romania<OPTION>Russian Federation<OPTION>Rwanda<OPTION>S Georgia and S Sandwich Isles<OPTION>Saint Kitts and Nevis<OPTION>Saint Lucia<OPTION>Saint Vincent and The Grenadines<OPTION>Samoa<OPTION>San Marino<OPTION>Sao Tome and Principe<OPTION>Saudi Arabia<OPTION>Senegal<OPTION>Seychelles<OPTION>Sierra Leone<OPTION>Singapore<OPTION>Slovak Republic<OPTION>Slovenia<OPTION>Solomon Islands<OPTION>Somalia<OPTION>South Africa<OPTION>Spain<OPTION>Sri Lanka<OPTION>St. Helena<OPTION>St. Pierre and Miquelon<OPTION>Sudan<OPTION>Suriname<OPTION>Svalbard and Jan Mayen Islands<OPTION>Swaziland<OPTION>Sweden<OPTION>Switzerland<OPTION>Syria<OPTION>Taiwan<OPTION>Tajikistan<OPTION>Tanzania<OPTION>Thailand<OPTION>Togo<OPTION>Tokelau<OPTION>Tonga<OPTION>Trinidad and Tobago<OPTION>Tunisia<OPTION>Turkey<OPTION>Turkmenistan<OPTION>Turks and Caicos Islands<OPTION>Tuvalu<OPTION>US Minor Outlying Islands<OPTION>Uganda<OPTION>Ukraine<OPTION>United Arab Emirates<OPTION>United Kingdom<OPTION>United States<OPTION>Uruguay<OPTION>Uzbekistan<OPTION>Vanuatu<OPTION>Vatican City State<OPTION>Venezuela<OPTION>Viet Nam<OPTION>British Virgin Islands<OPTION>US Virgin Islands<OPTION>Wallis and Futuna Islands<OPTION>Western Sahara<OPTION>Yemen<OPTION>Yugoslavia<OPTION>Zaire<OPTION>Zambia<OPTION>Zimbabwe</select>
						</select>
					</td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Tel ; ?> : </td>
					<td><input type="text" name="c_tel"  style="width: 300px" value="<?php echo $row->c_tel ; ?>"/></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Fax ; ?> : </td>
					<td><input type="text" name="c_fax"  style="width: 300px" value="<?php echo $row->c_fax ; ?>"/></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Email ; ?> : </td>
					<td><textarea name="c_email"  rows="5" style="width: 300px"><?php echo $row->c_email ; ?></textarea></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Web ; ?> : </td>
					<td><input type="text" name="c_web"  style="width: 300px" value="<?php echo $row->c_web ; ?>"/></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Foundation ; ?> : </td>
					<td><input type="text" name="c_found"  style="width: 300px" value="<?php echo $row->c_web ; ?>"/></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Casa_Diocese ; ?> : </td>
					<td><input type="text" name="c_diocese"  style="width: 300px" value="<?php echo $row->c_diocese ; ?>"/></td>
				</tr>

				<tr>
					<td align="center" colspan="2" height="40">
						<input type="submit" value="   <?php echo _Congregation_Update_Button ; ?>   ">
					</td>
				</tr>
			</table>
			</form>
	<?php
	}


	function province_view( &$row, $option ) {
		global $params, $Itemid, $access;
			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo $row->p_name ; ?>
			</div>
			<?php

				if($access->canEdit) {

					?>
				<script language="JavaScript">
				<!--
					function confirmDelete() {
						var agree=confirm("<?php echo _Profile_Delete_Confirm ; ?>");
						if (agree)
							return true;
						else
							return false ;
					}
				//-->
				</script>

				<div class="adminbox">
				<?php
					echo " <a href='"  . sefRelToAbs("index.php?option=$option&rub=province&task=edit&Itemid=$Itemid&p_id=$row->p_id") . "'>" . _Congregation_Edit . "</a> ";
					echo "  <a onclick='return confirmDelete()' href='"  . sefRelToAbs("index.php?option=$option&rub=province&task=delete&Itemid=$Itemid&p_id=$row->p_id") . "'>" . _Congregation_Delete . "</a> ";
					echo ' <a href="' . sefRelToAbs( "index.php?option=$option&rub=casa&task=new&Itemid=$Itemid&p_id=$row->p_id" ) . '">' . _Casa_Add_New . '</a>';
				?>
				</div>
				<?php

				}
			?>
			<table width="100%" border=0>
				<tr valign="top">
					<th><?php echo _Casa_Name ; ?> </th>
					<th><?php echo _Casa_City ; ?> </th>
					<th><?php echo _Casa_Country ; ?> </th>
					<th><?php echo _Casa_Members ; ?></th>
				<?php
					if($access->canEdit) {
						echo "<th colspan=2>" . _Congregation_Order . "</th>";
						echo "<th>" . _Congregation_Admin . "</th>";
					}
				?>
				</tr>
				<?php
				if($row->case) {
					foreach($row->case as $casa) {
						?>
				<tr valign="top">
					<td><?php echo $casa->c_name ; ?> </td>
					<td><?php echo $casa->c_city ; ?> </td>
					<td><?php echo $casa->c_country ; ?> </td>
					<td align="center"><?php echo $casa->c_members . '<a href="' . sefRelToAbs( "index.php?option=$option&rub=casa&Itemid=$Itemid&task=view&c_id=" . $casa->c_id ) . '"> (' . _Congregation_View . ')</a>'; ?></td>
				<?php
				if($access->canEdit) {
					echo '<td valign="top" width="12" align="center"><a href="' . sefRelToAbs( "index.php?option=$option&rub=casa&task=orderup&Itemid=$Itemid&p_id=$row->p_id&c_id=" . $casa->c_id ) . '"><img src="administrator/images/uparrow.png" width="12" height="12" border="0" alt="'. _Congregation_Move_Up .'"></a></td>';
					echo '<td valign="top" width="12" align="center"><a href="' . sefRelToAbs( "index.php?option=$option&rub=casa&task=orderdown&Itemid=$Itemid&p_id=$row->p_id&c_id=" . $casa->c_id ) . '"><img src="administrator/images/downarrow.png" width="12" height="12" border="0" alt="'. _Congregation_Move_Down .'"></a></td>';

					echo '<td valign="top" align="center">';
					echo '<a href="' . sefRelToAbs( "index.php?option=$option&rub=casa&task=edit&Itemid=$Itemid&c_id=" . $casa->c_id ."&p_id=" . $casa->p_id ) . '">' . _Congregation_Edit . '</a> ';
					echo " <a onclick='return confirmDelete()' href='"  . sefRelToAbs( "index.php?option=$option&rub=casa&task=delete&c_id=$casa->c_id") . "'>" . _Congregation_Delete . "</a>";

					echo "</td>";
				}
				?>

				</tr>
						<?php
					}
				}
				?>
			</table>
<?php

	}




	function province_edit( &$row, $option, &$lists ) {
		global $params, $Itemid;
			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo _Province_Edit; ?>
			</div>
			<form method="post" action="index.php">
					<input type="hidden" name="p_id" value="<?php echo $row->p_id ;?>" />
					<input type="hidden" name="option" value="<?php echo $option ;?>" />
					<input type="hidden" name="Itemid" value="<?php echo $Itemid ;?>" />
					<input type="hidden" name="rub" value="province" />
					<input type="hidden" name="task" value="save" />
			<table >
				<tr valign="top">
					<td><?php echo _Province_Name ; ?> : </td>
					<td><input type="text" name="p_name"  style="width: 300px" value="<?php echo $row->p_name ; ?>"/></td>
				</tr>
			<tr>
				<td align="left">
				<?php echo _E_ORDERING; ?>
				</td>
				<td>
				<?php echo $lists['ordering']; ?>
				</td>
			</tr>
				<tr>
					<td align="center" colspan="2" height="40">
						<input type="submit" value="   <?php echo _Congregation_Update_Button ; ?>   ">
					</td>
				</tr>
			</table>
			</form>
	<?php

	}

	function province_list( &$rows, $option ) {
		global $params, $Itemid, $access;
			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo _Province_List; ?>
			</div>
			<?php
				if($access->canEdit) {
				?>
				<script language="JavaScript">
				<!--
					function confirmDelete() {
						var agree=confirm("<?php echo _Province_Delete_Confirm ; ?>");
						if (agree)
							return true;
						else
							return false ;
					}
				//-->
				</script>

				<?php
					echo '<table width="100%">' ;
					echo '<tr align="right"><td><a href="' . sefRelToAbs( "index.php?option=$option&rub=province&Itemid=$Itemid&task=new" ) . '">' . _Province_Add_New . '</td></tr>';
					echo '</table>' ;
				}
			?>
			<table width="100%" border=0>
				<tr valign="top">
					<th><?php echo _Province_Name ; ?> </th>
					<th><?php echo _Province_Communities ; ?></th>
				<?php
					if($access->canEdit) {
						echo "<th colspan=2>" . _Congregation_Order . "</th>";
						echo "<th>" . _Congregation_Admin . "</th>";
					}
				?>
				</tr>
				<?php
				if($rows) {
					foreach($rows as $row) {
						?>
				<tr valign="top">
					<td><?php echo $row->p_name ; ?> </td>
					<td align="center"><?php echo $row->p_case . '<a href="' . sefRelToAbs( "index.php?option=$option&rub=province&task=view&Itemid=$Itemid&p_id=" . $row->p_id) . '">' .  ' (' . _Congregation_View . ')</a>'; ?></td>
				<?php
				if($access->canEdit) {
				echo '<td valign="top" width="12" align="center"><a href="' . sefRelToAbs( "index.php?option=$option&rub=province&task=orderup&Itemid=$Itemid&p_id=" . $row->p_id ) . '"><img src="administrator/images/uparrow.png" width="12" height="12" border="0" alt="'. _Congregation_Move_Up .'"></a></td>';
				echo '<td valign="top" width="12" align="center"><a href="' . sefRelToAbs( "index.php?option=$option&rub=province&task=orderdown&Itemid=$Itemid&p_id=" . $row->p_id ) . '"><img src="administrator/images/downarrow.png" width="12" height="12" border="0" alt="'. _Congregation_Move_Down .'"></a></td>';

				echo '<td valign="top" align="center">';
					echo '<a href="' . sefRelToAbs("index.php?option=$option&rub=province&task=edit&Itemid=$Itemid&p_id=" . $row->p_id ) . '">' . _Congregation_Edit . '</a> <a href="' . sefRelToAbs("index.php?option=$option&rub=province&task=delete&Itemid=$Itemid&p_id=" . $row->p_id ) . '"  onclick="return confirmDelete()">' . _Congregation_Delete . '</a></td>';
				}
				?>

				</tr>
						<?php
					}
				}
				?>
			</table>
<?php
		if ($pageNav->total>$pageNav->limit) {
?>
                <table width="100%"><tr><td align="right"><?php echo $pageNav->writePagesCounter(); ?></td></tr></table>
<?php
		}
?>
			</form>
	<?php

	}





	function profile_search_form( &$nations, &$languageList, $option ) {
		global $params, $Itemid;
			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo _Profile_Search_Form; ?>
			</div>
			<form method="get" action="index.php">
					<input type="hidden" name="option" value="<?php echo $option ;?>" />
					<input type="hidden" name="Itemid" value="<?php echo $Itemid ;?>" />
					<input type="hidden" name="rub" value="member" />
					<input type="hidden" name="task" value="list" />
			<table >
				<tr valign="top">
					<td><?php echo _Profile_Search ; ?> : </td>
					<td><input type="text" name="txtsearch"  style="width: 300px"/></td>
				</tr>
				<tr valign='top'>
					<td><?php echo _Profile_Country ; ?> : </td>
					<td><select name="nationality" style="width: 300px">
					<option />
					<?php
	  foreach($nations as $nation) {
		echo  "<option value='" . $nation->nationality . "'>" . $nation->nationality . "</option>";
	  }
	  ?>
					  </select></td>
				</tr>
				<tr valign='top'>
					<td><?php echo _Profile_Lang ; ?> : </td>
					<td><select name="language" style="width: 300px">
					<option />
					<?php
	  foreach($languageList as $language) {
		echo  "<option value='" . $language->iso . "'>" . $language->name . "</option>";
	  }
	  ?>
					  </select></td>
				</tr>
				<tr>
					<td align="center" colspan="2" height="40">
						<input type="submit" value="   <?php echo _Profile_Search_Button; ?>   ">
					</td>
				</tr>
			</table>
			</form>
	<?php

	}
	function profile_show( &$row, $option ) {
		global $params, $Itemid, $mosConfig_live_site;
/////////////////



?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
				<?php echo $row->status_abbr . " " . $row->fname . " " . $row->lname ; ?>
			</div>

			<?php
				if($access->canEdit) {
					?>
				<script language="JavaScript">
				<!--
					function confirmDelete() {
						var agree=confirm("<?php echo _Profile_Delete_Confirm ; ?>");
						if (agree)
							return true;
						else
							return false ;
					}
				//-->
				</script>

				<div class="adminbox">
				<?php
				echo "<a href='"  . sefRelToAbs( "index.php?option=$option&rub=member&task=edit&Itemid=$Itemid&username=$row->username" ) . "'>" . _Congregation_Edit . "</a> ";
				echo "<a onclick='return confirmDelete()' href='"  . sefRelToAbs( "index.php?option=$option&rub=member&task=delete&Itemid=$Itemid&username=$row->username" ) . "'>" . _Congregation_Delete . "</a> ";
				?>
				</div>

					<?php
				}
			?>

<?php
		echo "
		<script language=\"JavaScript\">
		<!--
		function PopupAlbum(titre, img) {
		w=open(\"\",'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=yes');
		w.document.write(\"<HTML><HEAD><TITLE>\"+titre+\"</TITLE></HEAD>\");
		w.document.write(\"<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+55,document.images[0].height+130); window.focus();} else { setTimeout('check()',250) } }</\"+\"SCRIPT>\");
		w.document.write(\"<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>\");
		w.document.write(\"<table border=1 cellpadding=20px cellspacing=0><tr><td align=center>\");
		w.document.write(\"<IMG src='\"+img+\"' border=0>\");
		w.document.write(\"</td></tr><table>\");
		w.document.write(\"</BODY></HTML>\");
		w.focus();
		w.document.close();
		}
		-->
		</script>
		<br>
		<table border=0 cellspacing=3 cellpadding=5>
		";
		if($row->picfile) {
		echo "
		<tr>
		<td valign='top' colspan='2' align='center'>
		 <tr>
		  <td valign='top' colspan='2' align='center'>
		  <a href=\"javascript:PopupAlbum('". $row->fname . " " . $row->lname. "', '" . $mosConfig_live_site . "/media/profiles/b".$row->picfile. "')\" ><img src='" . $mosConfig_live_site . "/media/profiles/s". $row->picfile . "' border='0' width='100'></a>
		  </td>
		 </tr>
		</td>
		</tr>
		";
		}
		echo "
		<tr>
		<td valign='top'>
		<b> ";
		echo _Casa_Name ;
		echo " : </b>
		</td>
		<td valign='top'>
		<a href='" . sefRelToAbs("index.php?option=$option&rub=casa&Itemid=$Itemid&c_id=$row->c_id") . "'>$row->c_name</a>
		</td>
		</tr>
		<tr>
		<td valign='top'>
		<b> ";
		echo _Profile_Email ;
		echo " : </b>
		</td>
		<td valign='top'>
		<a href='?rub=members/sendmail&to=$row->email'>$row->email</a>
		</td>
		</tr>
		";
		if($row->skype) {
		echo "
		<tr>
		<td valign='top'>
		<b> ";
		echo _Profile_Skype ;
		echo " : </b>
		</td>
		<td valign='top'>
		<a href='callto://$row->skype'>$row->skype</a> <a href='callto://$row->skype'><img src='http://rcj.org/homeicons/icon_msnm.gif' width='80' height='18' border='0' alt='Skype me'></a>
		</td>
		</tr>
		";
		}
		echo "
		<tr>
		<td valign='top'>
		<b> ";
		echo _Profile_Cell ;
		echo " : </b>
		</td>
		<td valign='top'>
		$row->cell
		</td>
		</tr>
		<tr>
		<td valign='top'>
		<b> ";
		echo _Profile_Country ;
		echo " : </b>
		</td>
		<td valign='top'>
		$row->nationality
		</td>
		</tr>
		";
		$b_label[0] = _Profile_Birth;
		$b_label[1] = _Profile_Entry;
		$b_label[2] = _Profile_Novitiate;
		$b_label[3] = _Profile_Prof;
		$b_label[4] = _Profile_Final;
		$b_label[5] = _Profile_Ordination;
		$b_day[0] = substr($row->bdate, 8, 2);
		$b_month[0] = substr($row->bdate, 5, 2);
		$b_year[0] = substr($row->bdate, 0, 4);
		$b_place[0] = $row->bplace;
		$b_day[1] = substr($row->edate, 8, 2);
		$b_month[1] = substr($row->edate, 5, 2);
		$b_year[1] = substr($row->edate, 0, 4);
		$b_place[1] = $row->eplace;
		$b_day[2] = substr($row->ndate, 8, 2);
		$b_month[2] = substr($row->ndate, 5, 2);
		$b_year[2] = substr($row->ndate, 0, 4);
		$b_place[2] = $row->nplace;
		$b_day[3] = substr($row->vdate, 8, 2);
		$b_month[3] = substr($row->vdate, 5, 2);
		$b_year[3] = substr($row->vdate, 0, 4);
		$b_place[3] = $row->vplace;
		$b_day[4] = substr($row->fdate, 8, 2);
		$b_month[4] = substr($row->fdate, 5, 2);
		$b_year[4] = substr($row->fdate, 0, 4);
		$b_place[4] = $row->fplace;
		$b_day[5] = substr($row->odate, 8, 2);
		$b_month[5] = substr($row->odate, 5, 2);
		$b_year[5] = substr($row->odate, 0, 4);
		$b_place[5] = $row->oplace;
		for($m=0; $m<=5; $m++) {
		echo "
		<tr>
		<td valign='top'>
		<b> $b_label[$m]  : </b>
		</td>
		<td valign='top'>
		$b_day[$m] / $b_month[$m] / $b_year[$m]
		</td>
		</tr>
		<tr>
		<td valign='top'><b>";
		echo _Profile_Place . " " . $b_label[$m] . ": </b>
		</td>
		<td valign='top'>
		$b_place[$m]
		</td>
		</tr>
		";
		}
		echo "
		<tr>
		<td valign='top'>
		<b> ";
		echo _Profile_Lang ;
		echo " : </b>
		</td>
		<td valign='top'>
		" . $row->language . "
		</td>
		</tr>
	</table>
		";


/////////////////
	}

	function profile_list(&$rows, $option, &$pageNav) {
		global $Itemid, $params, $access;

		if ( $params->get( 'header' ) ) {
			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo $params->get( 'header' ); ?>
			</div>
			<?php
		} else {
			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php _Profile_List; ?>
			</div>
<?php
		}

?>
			<script language="JavaScript">
			<!--
				function confirmDelete() {
					var agree=confirm("<?php echo _Profile_Delete_Confirm ; ?>");
					if (agree)
						return true;
					else
						return false ;
				}
			//-->
			</script>
			<?php
				echo $pageNav->writePagesCounter(); 
			?>
			<form action="index.php" method="get">
			<table border="0" width="100%">
				<tr valign="top">
					<td align="right">
					<?php echo _Profile_Search ?>
					<input type='text' name='txtsearch' size=30 />
					<input type='submit' name='bouton' value="   <?php echo _Profile_Search_Button ;?>   " />
					<input type="hidden" name="option" value="<?php echo $option ;?>" />
					<input type="hidden" name="Itemid" value="<?php echo $Itemid ;?>" />
					<input type="hidden" name="rub" value="member" />
					<input type="hidden" name="task" value="list" /><br>
					<a href="<?php echo sefRelToAbs("index.php?option=$option&rub=member&task=search&Itemid=$Itemid") ;?>"><?php echo _Profile_Advanced_Search ;?></a>
			</table>
			</form>

			<?php if($rows) { ?>
			<table border="0" width="100%">
				<tr>
				<th><?php
					echo _Profile_Username;
				?></th>
				<th><?php
					echo _Profile_Name;
				?></th>
				<th><?php
					echo _Profile_Email;
				?></th>
				<?php
					if($access->canEdit) {
						echo "<th>" . _Profile_Admin . "</th>";
					}
				?>
				</tr>
<?php
			foreach($rows as $row) {

				echo "<tr><td valign='top'>";
				echo '<a href="' . sefRelToAbs("index.php?option=$option&rub=member&Itemid=$Itemid&username=" . $row->lusername ) . '">' . $row->lusername . '</a></td>';
				echo "<td valign='top'>";
				echo $row->lname . ' ' . $row->fname . '</td>';
				echo "<td valign='top'>";
				echo $row->lemail . '</td>';
				if($access->canEdit) {
				echo '<td valign="top" align="center">';
					echo '<a href="' . sefRelToAbs("index.php?option=$option&rub=member&task=edit&Itemid=$Itemid&username=" . $row->lusername ) . '">' . _Profile_Edit . '</a> <a href='. sefRelToAbs("index.php?option=$option&rub=member&task=delete&Itemid=$Itemid&username=" . $row->lusername )  .' onclick="return confirmDelete()">' . _Congregation_Delete . '</a></td>';
				}
				echo '</tr>';
			}
			echo '</table>';

		}
		else
		{
			echo _Profile_Not_Found;
		}

		
		if ($pageNav->total > $pageNav->limit) {
		$link = "index.php?option=$option&rub=member&Itemid=$Itemid";
?>
                <table align="center"><tr><td><?php echo $pageNav->writePagesLinks($link); ?></td></tr></table>
<?php
		}
	}


	function profile_edit(&$row, $option, &$lists) {
		global $Itemid, $params, $my;

		if ( $params->get( 'header' ) ) {
			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo $params->get( 'header' ); ?>
			</div>
			<?php
		} else {
			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php _Profile_Update_Heading; ?>
			</div>
<?php
		}

		echo "
<form method=post action='index.php' enctype='multipart/form-data'>";
 	echo '<input type="hidden" name="username" value="'. $row->username .'" />';
	echo '<input type="hidden" name="Itemid" value="'. $Itemid .'" />';
 	echo '<input type="hidden" name="rub" value="member" />';
 	echo '<input type="hidden" name="task" value="save" />';
 	echo '<input type="hidden" name="option" value="com_congregation" />';

		echo "
		<script language=\"JavaScript\">
		<!--
		function PopupAlbum(titre, img) {
		w=open(\"\",'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=yes');
		w.document.write(\"<HTML><HEAD><TITLE>\"+titre+\"</TITLE></HEAD>\");
		w.document.write(\"<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+55,document.images[0].height+130); window.focus();} else { setTimeout('check()',250) } }</\"+\"SCRIPT>\");
		w.document.write(\"<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>\");
		w.document.write(\"<table border=1 cellpadding=20px cellspacing=0><tr><td align=center>\");
		w.document.write(\"<IMG src='\"+img+\"' border=0>\");
		w.document.write(\"</td></tr><table>\");
		w.document.write(\"</BODY></HTML>\");
		w.focus();
		w.document.close();
		}
		-->
		</script>

<table align='left' border=0 cellspacing=3 cellpadding=5>
 <tr>
  <td valign='top'>
   		<b> ";
		echo _Profile_Username ;
		echo " : </b>
  </td>
  <td valign='top'>
    $row->username
  </td>
 </tr>
";
if($row->picfile) {
echo  "
 <tr>
  <td valign='top' colspan='2' align='center'>
  <a href=\"javascript:PopupAlbum('". $row->fname . " " . $row->lname. "', 'media/".$row->picfile. "')\" ><img src='media/s". $row->picfile . "' border='0' width='100'></a><br />
	  <input type='checkbox' name='removepic' value='1'> Remove <br />
  </td>
 </tr>
";
}

echo  "
 <tr>
  <td valign='top'>
		<b> ";
		echo _Profile_Photo ;
		echo " : </b>
  </td>
  <td>
   <input type='file' size='30' name='imagefile' style='width: 300px'><br>
  </td>
 </tr>
	";

echo  "
<tr>
  <td valign='top'>
		<b> ";
		echo _Profile_New_Pass ;
		echo " : </b>

  </td>
  <td valign='top'>
   <input type='password' size='30' name='newpass' style='width: 300px'><br>
  </td>
 </tr>
<tr>
  <td valign='top'>
		<b> ";
		echo _Profile_Verify_Pass ;
		echo " : </b>

  </td>
  <td valign='top'>
   <input type='password' size='30' name='verifypass' style='width: 300px'><br>
  </td>
 </tr>
 <tr>
  <td valign='top'>
		<b> ";
		echo _Profile_Alt_Email ;
		echo " : </b>

  </td>
  <td valign='top'>
   <input type=text name='altemail' value='$row->altemail' style='width: 200px'>
  </td>
 </tr>
 <tr>
  <td valign='top'>
		<b> ";
		echo _Profile_Last_Name ;
		echo " : </b>

  </td>
  <td valign='top'>
   <input type=text name='lname' value='$row->lname' style='width: 200px'>
  </td>
 </tr>
 <tr>
  <td valign='top'>
		<b> ";
		echo _Profile_First_Name ;
		echo " : </b>

  </td>
  <td valign='top'>
   <input type=text name='fname' value='$row->fname' style='width: 200px'>
  </td>
 </tr>
";


	$b_label[0] = _Profile_Birth;
	$b_label[1] = _Profile_Entry;
	$b_label[2] = _Profile_Novitiate;
	$b_label[3] = _Profile_Prof;
	$b_label[4] = _Profile_Final;
	$b_label[5] = _Profile_Ordination;
	$b_label[6] = _Profile_Death;

	$b_day[0] = substr($row->bdate, 8, 2);
	$b_month[0] = substr($row->bdate, 5, 2);
	$b_year[0] = substr($row->bdate, 0, 4);
	$b_place[0] = $row->bplace;

	$b_day[1] = substr($row->edate, 8, 2);
	$b_month[1] = substr($row->edate, 5, 2);
	$b_year[1] = substr($row->edate, 0, 4);
	$b_place[1] = $row->eplace;

	$b_day[2] = substr($row->ndate, 8, 2);
	$b_month[2] = substr($row->ndate, 5, 2);
	$b_year[2] = substr($row->ndate, 0, 4);
	$b_place[2] = $row->nplace;

	$b_day[3] = substr($row->vdate, 8, 2);
	$b_month[3] = substr($row->vdate, 5, 2);
	$b_year[3] = substr($row->vdate, 0, 4);
	$b_place[3] = $row->vplace;

	$b_day[4] = substr($row->fdate, 8, 2);
	$b_month[4] = substr($row->fdate, 5, 2);
	$b_year[4] = substr($row->fdate, 0, 4);
	$b_place[4] = $row->fplace;

	$b_day[5] = substr($row->odate, 8, 2);
	$b_month[5] = substr($row->odate, 5, 2);
	$b_year[5] = substr($row->odate, 0, 4);
	$b_place[5] = $row->oplace;

	$b_day[6] = substr($row->ddate, 8, 2);
	$b_month[6] = substr($row->ddate, 5, 2);
	$b_year[6] = substr($row->ddate, 0, 4);
	$b_place[6] = $row->dplace;

$date_field = 6;
if($row->username == $my->username) {
	$date_field = 5;
}
for($m=0; $m<=$date_field; $m++) {
 echo  "
 <tr>
  <td valign='top'>
   <b>$b_label[$m] : </b>
  </td>
  <td valign='top'>

<SELECT name='b_day[]'>
<OPTION selected>$b_day[$m]<OPTION>1 <OPTION>2 <OPTION>3 <OPTION>4
<OPTION>5 <OPTION>6 <OPTION>7 <OPTION>8 <OPTION>9
<OPTION>10
<OPTION>11 <OPTION>12 <OPTION>13 <OPTION>14
<OPTION>15 <OPTION>16 <OPTION>17 <OPTION>18
<OPTION>19 <OPTION>20 <OPTION>21
<OPTION>22 <OPTION>23 <OPTION>24 <OPTION>24
<OPTION>25 <OPTION>26 <OPTION>27 <OPTION>28
<OPTION>29 <OPTION>30 <OPTION>31
</SELECT>
<select name='b_month[]'>
<option value='$b_month[$m]' selected>$b_month[$m]</option>
";

for ($i=1; $i<=12; $i++) {
	echo  "<option value='$i'>$i</option>";
}

echo  "
</select>
<select name='b_year[]'>
<option selected>$b_year[$m]</option>";

$thisyear = date("Y");

for ($j = $thisyear - 200 ;$j <= $thisyear ; $j++) {
	echo  "<option value='$j'>$j</option>\n";
}
echo  "
</select> dd/mm/yyyy
  </td>
 </tr>
<tr>
  <td valign='top'><b>";
echo _Profile_Place . " " . $b_label[$m] . ": </b>
  </td>
  <td valign='top'>
   <input type=text name='b_place[]' value='$b_place[$m]' style='width: 200px'>
  </td>
 </tr>
";

}


echo  "
 <tr>
  <td valign='top'>
		<b> ";
		echo _Profile_Status ;
		echo " : </b>

  </td>
  <td valign='top'>
   <select name='status'>
 ";
	  foreach($lists['status'] as $status) {
	  	$selected = ($status->id == $row->status) ? " selected " : "";
		echo  "<option value='" . $status->id . "' $selected >" . $status->text . "</option>";
	  }

echo  "
   </select>
  </td>
 </tr>
 <tr>
  <td valign='top'>
		<b> ";
		echo _Profile_Country ;
		echo " : </b>

  </td>
  <td valign='top'>
<select name='nationality'>
<option selected>$row->nationality<OPTION>Afghanistan<OPTION>Albania<OPTION>Algeria<OPTION>American Samoa<OPTION>Andorra<OPTION>Angola<OPTION>Anguilla<OPTION>Antarctica<OPTION>Antigua and arbuda<OPTION>Argentina<OPTION>Armenia<OPTION>Aruba<OPTION>Australia<OPTION>Austria<OPTION>Azerbaijan<OPTION>Bahamas<OPTION>Bahrain<OPTION>Bangladesh<OPTION>Barbados<OPTION>Belarus<OPTION>Belgium<OPTION>Belize<OPTION>Benin<OPTION>Bermuda<OPTION>Bhutan<OPTION>Bolivia<OPTION>Bosnia and Herzegovina<OPTION>Botswana<OPTION>Bouvet Island<OPTION>Brazil<OPTION>British Indian Ocean Territory<OPTION>Brunei Darussalam<OPTION>Bulgaria<OPTION>Burkina Faso<OPTION>Burundi<OPTION>Cambodia<OPTION>Cameroon<OPTION>Canada<OPTION>Cape Verde<OPTION>Cayman Islands<OPTION>Central African Republic<OPTION>Chad<OPTION>Chile<OPTION>China<OPTION>Christmas Island<OPTION>Cocos Keeling Islands<OPTION>Colombia<OPTION>Comoros<OPTION>Congo<OPTION>Cook Islands<OPTION>Costa Rica<OPTION>Ivory Coast<OPTION>Croatia<OPTION>Cuba<OPTION>Cyprus<OPTION>Czech Republic<OPTION>Denmark<OPTION>Djibouti<OPTION>Dominican Republic<OPTION>Dominica<OPTION>East Timor<OPTION>Ecuador<OPTION>Egypt<OPTION>El Salvador<OPTION>Equatorial Guinea<OPTION>Eritrea<OPTION>Estonia<OPTION>Ethiopia<OPTION>Falkland Islands<OPTION>Faroe Islands<OPTION>Fiji<OPTION>Finland<OPTION>France<OPTION>French Guiana<OPTION>French Polynesia<OPTION>French Southern Territories<OPTION>Gabon<OPTION>Gambia<OPTION>Georgia<OPTION>Germany<OPTION>Ghana<OPTION>Gibraltar<OPTION>Greece<OPTION>Greenland<OPTION>Grenada<OPTION>Guadeloupe<OPTION>Guam<OPTION>Guatemala<OPTION>Guinea-Bissau<OPTION>Guinea<OPTION>Guyana<OPTION>Haiti<OPTION>Heard and McDonald Islands<OPTION>Honduras<OPTION>Hong Kong<OPTION>Hungary<OPTION>Iceland<OPTION>India<OPTION>Indonesia<OPTION>Iran<OPTION>Iraq<OPTION>Ireland<OPTION>Israel<OPTION>Italy<OPTION>Jamaica<OPTION>Japan<OPTION>Jordan<OPTION>Kazakhstan<OPTION>Kenya<OPTION>Kiribati<OPTION>North Korea<OPTION>South Korea<OPTION>Kuwait<OPTION>Kyrgyzstan<OPTION>Laos<OPTION>Latvia<OPTION>Lebanon<OPTION>Lesotho<OPTION>Liberia<OPTION>Libya<OPTION>Liechtenstein<OPTION>Lithuania<OPTION>Luxembourg<OPTION>Macau<OPTION>Macedonia<OPTION>Madagascar<OPTION>Malawi<OPTION>Malaysia<OPTION>Maldives<OPTION>Mali<OPTION>Malta<OPTION>Marshall slands<OPTION>Martinique<OPTION>Mauritania<OPTION>Mauritius<OPTION>Mayotte<OPTION>Mexico<OPTION>Micronesia<OPTION>Moldova<OPTION>Monaco<OPTION>Mongolia<OPTION>Montserrat<OPTION>Morocco<OPTION>Mozambique<OPTION>Myanmar<OPTION>Namibia<OPTION>Nauru<OPTION>Nepal<OPTION>Netherlands Antilles<OPTION>Netherlands<OPTION>New Caledonia<OPTION>New Zealand<OPTION>Nicaragua<OPTION>Nigeria<OPTION>Niger<OPTION>Niue<OPTION>Norfolk Island<OPTION>Northern Mariana slands<OPTION>Norway<OPTION>Oman<OPTION>Pakistan<OPTION>Palau<OPTION>Panama<OPTION>Papua New Guinea<OPTION>Paraguay<OPTION>Peru<OPTION>Philippines<OPTION>Pitcairn<OPTION>Poland<OPTION>Portugal<OPTION>Puerto Rico<OPTION>Qatar<OPTION>Reunion<OPTION>Romania<OPTION>Russian Federation<OPTION>Rwanda<OPTION>S Georgia and S Sandwich Isles<OPTION>Saint Kitts and Nevis<OPTION>Saint Lucia<OPTION>Saint Vincent and The Grenadines<OPTION>Samoa<OPTION>San Marino<OPTION>Sao Tome and Principe<OPTION>Saudi Arabia<OPTION>Senegal<OPTION>Seychelles<OPTION>Sierra Leone<OPTION>Singapore<OPTION>Slovak Republic<OPTION>Slovenia<OPTION>Solomon Islands<OPTION>Somalia<OPTION>South Africa<OPTION>Spain<OPTION>Sri Lanka<OPTION>St. Helena<OPTION>St. Pierre and Miquelon<OPTION>Sudan<OPTION>Suriname<OPTION>Svalbard and Jan Mayen Islands<OPTION>Swaziland<OPTION>Sweden<OPTION>Switzerland<OPTION>Syria<OPTION>Taiwan<OPTION>Tajikistan<OPTION>Tanzania<OPTION>Thailand<OPTION>Togo<OPTION>Tokelau<OPTION>Tonga<OPTION>Trinidad and Tobago<OPTION>Tunisia<OPTION>Turkey<OPTION>Turkmenistan<OPTION>Turks and Caicos Islands<OPTION>Tuvalu<OPTION>US Minor Outlying Islands<OPTION>Uganda<OPTION>Ukraine<OPTION>United Arab Emirates<OPTION>United Kingdom<OPTION>United States<OPTION>Uruguay<OPTION>Uzbekistan<OPTION>Vanuatu<OPTION>Vatican City State<OPTION>Venezuela<OPTION>Viet Nam<OPTION>British Virgin Islands<OPTION>US Virgin Islands<OPTION>Wallis and Futuna Islands<OPTION>Western Sahara<OPTION>Yemen<OPTION>Yugoslavia<OPTION>Zaire<OPTION>Zambia<OPTION>Zimbabwe</select>

	  </td>
 </tr>
 <tr>
  <td valign='top'>
		<b> ";
		echo _Profile_Lang ;
		echo " : </b>

  </td>
  <td valign='top'>
          <select name=\"language\" ><option />
";
	  foreach($lists['language'] as $language) {
	  	$selected = ($language->iso == $row->language) ? " selected " : "";
		echo  "<option value='" . $language->iso . "' $selected >" . $language->name . "</option>";
	  }
	echo  "
          </select>
  </td>
 </tr>
 <tr>
  <td valign='top'>
		<b> ";
		echo _Profile_Community ;
		echo " : </b>

  </td>
  <td valign='top'>
     <select class='input_gen' name='c_id' style='width:200'>
	  <option />
  ";
    foreach($lists['casa'] as $casa) {
      $selected = ($casa->c_id == $row->c_id) ? " selected ": "";
      echo  "<option value='" . $casa->c_id . "' $selected>". $casa->c_city . " - ". $casa->c_name . "</option>\n";
    }

echo  "
   </select>
  </td>
 </tr>
 <tr>
  <td valign='top'>
		<b> ";
		echo _Profile_Cell ;
		echo " : </b>

  </td>
  <td valign='top'>
   <input type=text name='cell' value='$row->cell' style='width: 200px'>
  </td>
 </tr>
 <tr>
  <td valign='top'>
   <b>";
  echo _Profile_Skype;
  echo " </b>
  </td>
  <td valign='top'>
   <input type=text name='skype' value='$row->skype' style='width: 200px'>
  </td>
 </tr>
 <tr>
  <td colspan=2 align='right'>
   [" . gmdate("d/m/Y H:i:s", $row->lastupdate) . " GMT]
  </td>
 </tr>
 <tr>
  <td valign='top' colspan=2 align=center>
	<input type=submit name='' value='     ";
		echo _Profile_Update ;
		echo "     '>
  </td>
 </tr>
</table>
</form>
";

	}


/**
* Status manager
*/
	function status_view( &$row, $option ) {
		global $params, $Itemid, $access;
			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo $row->_Status_Heading ; ?>
			</div>
			<?php

				if($access->canEdit) {

					?>
				<script language="JavaScript">
				<!--
					function confirmDelete() {
						var agree=confirm("<?php echo _Profile_Delete_Confirm ; ?>");
						if (agree)
							return true;
						else
							return false ;
					}
				//-->
				</script>

				<div class="adminbox">
				<?php
					echo " <a href='"  . sefRelToAbs("index.php?option=$option&rub=status&task=edit&Itemid=$Itemid&id=$row->id") . "'>" . _Congregation_Edit . "</a> ";
					echo "  <a onclick='return confirmDelete()' href='"  . sefRelToAbs("index.php?option=$option&rub=status&task=delete&Itemid=$Itemid&id=$row->id") . "'>" . _Congregation_Delete . "</a> ";
					echo ' <a href="' . sefRelToAbs( "index.php?option=$option&rub=casa&task=new&Itemid=$Itemid&id=$row->id" ) . '">' . _Casa_Add_New . '</a>';
				?>
				</div>
				<?php

				}
			?>

<?php

	}

	function status_edit( &$row, $option, &$lists ) {
		global $params, $Itemid;
			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo _Status_Edit; ?>
			</div>
			<form method="post" action="index.php">
					<input type="hidden" name="id" value="<?php echo $row->id ;?>" />
					<input type="hidden" name="option" value="<?php echo $option ;?>" />
					<input type="hidden" name="Itemid" value="<?php echo $Itemid ;?>" />
					<input type="hidden" name="rub" value="status" />
					<input type="hidden" name="task" value="save" />
			<table >
				<tr valign="top">
					<td><?php echo _Status_Abbr ; ?> : </td>
					<td><input type="text" name="abbr"  style="width: 300px" value="<?php echo $row->abbr ; ?>"/></td>
				</tr>
				<tr valign="top">
					<td><?php echo _Status_Name ; ?> : </td>
					<td><input type="text" name="text"  style="width: 300px" value="<?php echo $row->text ; ?>"/></td>
				</tr>
			<tr>
				<td align="left">
				<?php echo _E_ORDERING; ?>
				</td>
				<td>
				<?php echo $lists['ordering']; ?>
				</td>
			</tr>
				<tr>
					<td align="center" colspan="2" height="40">
						<input type="submit" value="   <?php echo _Congregation_Update_Button ; ?>   ">
					</td>
				</tr>
			</table>
			</form>
	<?php

	}

	function status_list( &$rows, $option ) {
		global $params, $Itemid, $access;
			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo _Status_List; ?>
			</div>
			<?php
				if($access->canEdit) {
					echo '<div class="adminbox">' ;
					echo '<a href="' . sefRelToAbs( "index.php?option=$option&rub=status&Itemid=$Itemid&task=new" ) . '">' . _Status_Add_New . '</a>';
					echo '</div>' ;
				}
			?>
			<table width="100%" border=0>
				<tr valign="top">
					<th><?php echo _Status_Abbr ; ?> </th>
					<th><?php echo _Status_Name ; ?></th>
				<?php
					if($access->canEdit) {
						echo "<th colspan=2>" . _Congregation_Order . "</th>";
						echo "<th>" . _Congregation_Admin . "</th>";
					}
				?>
				</tr>
				<?php
				if($rows) {
					foreach($rows as $row) {
						?>
				<tr valign="top">
					<td><?php echo $row->abbr ; ?> </td>
					<td><?php echo $row->text; // . '<a href="' . sefRelToAbs( "index.php?option=$option&rub=status&task=view&Itemid=$Itemid&id=" . $row->id) . '">' .  ' (' . _Congregation_View . ')</a>'; ?></td>
				<?php
				if($access->canEdit) {
				echo '<td valign="top" width="12" align="center"><a href="' . sefRelToAbs( "index.php?option=$option&rub=status&task=orderup&Itemid=$Itemid&id=" . $row->id ) . '"><img src="administrator/images/uparrow.png" width="12" height="12" border="0" alt="'. _Congregation_Move_Up .'"></a></td>';
				echo '<td valign="top" width="12" align="center"><a href="' . sefRelToAbs( "index.php?option=$option&rub=status&task=orderdown&Itemid=$Itemid&id=" . $row->id ) . '"><img src="administrator/images/downarrow.png" width="12" height="12" border="0" alt="'. _Congregation_Move_Down .'"></a></td>';

				echo '<td valign="top" align="center">';
					echo '<a href="' . sefRelToAbs("index.php?option=$option&rub=status&task=edit&Itemid=$Itemid&id=" . $row->id ) . '">' . _Congregation_Edit . '</a></td>';
				}
				?>

				</tr>
						<?php
					}
				}
				?>
			</table>
<?php
		if ($pageNav->total>$pageNav->limit) {
?>
                <table width="100%"><tr><td align="right"><?php echo $pageNav->writePagesCounter(); ?></td></tr></table>
<?php
		}
?>
			</form>
	<?php

	}



}
